from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship

from models.base import Base


class Item(Base):
    id = Column(Integer, primary_key=True)
    name = Column(String(100), nullable=False, unique=True)
    url = Column(String(255), unique=True)
    score_url = Column(String(255), unique=True)
    certi_url = Column(String(255), unique=True)
    category_id = Column(Integer, ForeignKey('category.id'))

    category = relationship('Category', backref='items')
